#!/bin/bash
sudo apt install -y ros-melodic-robot-upstart
sudo apt install -y libv4l-dev
sudo apt install python-pip
cd python-v4l2capture
sudo python setup.py install
cd ..
cd ..
wsroot=`pwd`
echo $wsroot
cd docs
grep "source ${wsroot}/devel/setup.bash" ~/.bashrc || echo "source ${wsroot}/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
rosrun robot_upstart uninstall cameraPush
rosrun robot_upstart install video_fuse_car/launch/small_car_fuse.launch --job cameraPush 
sudo cp rc-local.service /etc/systemd/system/rc-local.service
sudo systemctl enable rc-local
sudo systemctl start rc-local.service
cd drv
make
sudo insmod "${wsroot}/docs/drv/artosyn_usb_8020.ko"
sudo grep "#!/bin/bash" /etc/rc.local || echo "#!/bin/bash" | sudo tee -a /etc/rc.local
sudo grep "insmod ${wsroot}/docs/drv/artosyn_usb_8020.ko" /etc/rc.local || echo "insmod ${wsroot}/docs/drv/artosyn_usb_8020.ko" | sudo tee -a /etc/rc.local
sudo chmod +x /etc/rc.local
cd ..
